package com.cx;

import com.cx.repository.BaseRepositoryFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: 舒建辉
 * @Description:
 * @Date: Created on 2018/2/1
 * @Version: 1.0
 */
//@EnableCaching  //第二种方案：加注解方式  屏蔽后是第三种方案：缓存和数据库都保存
//@EnableRedisRepositories //第一种方案：只做redis缓存，不保存数据库  屏蔽后是第三种方案：缓存和数据库都保存
@EnableJpaRepositories(repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
@SpringBootApplication //(exclude= {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class})
public class SJRApplication {

    public static void main(String[] args) {
        SpringApplication.run(SJRApplication.class, args);
    }

    @Bean
    public ResourceBundleMessageSource resourceBundleMessageSource(){
        return new ResourceBundleMessageSource();
    }

    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
